package org.darkforest.dao.redis.impl;

import org.darkforest.dao.redis.GoodsClassRedisDao;
import org.darkforest.dao.redis.templete.AbstractListRedisOper;
import org.darkforest.model.GoodsClass;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by valentina on 15/2/18.
 * 商品分类列表在redis中的存储/读取操作
 */
@Component
public class GoodsClassRedisDaoImpl extends AbstractListRedisOper<GoodsClass> implements GoodsClassRedisDao {


    @Override
    public void addClassList(String key,List<GoodsClass> clsList) {
        this.addList(key,clsList);
    }

    @Override
    public List<GoodsClass> getGoodsClassList(String key) {
        return this.getList(key);
    }

    @Override
    public void deleteList(String key) {
        this.deleteListByKey(key);
    }

    @Override
    public GoodsClass getGoodsClass(String key, int index) {
        return this.get(key,index);
    }

    @Override
    public int getGoodsClassLength(String key) {
        return this.getListSize(key);
    }

    @Override
    public void addGoodsClass(String key, GoodsClass gc) {
        this.add(key,gc);
    }

    @Override
    public void updateGoodsClass(String key, int index, GoodsClass gc) {
        this.set(key,index,gc);
    }

    @Override
    public void removeGoodsClass(String key, int index) {
        this.remove(key,index);
    }

    @Override
    public void trimGoodsClassList(String key, int start, int end) {
        this.trim(key,start,end);
    }


}
